home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.7 KB | 81 lines | [TEXT/GEOL] |
- Item 8687747 16-Nov-90 23:44PST
-
- From: GER.XSE0067 Germany - Norbert Lindenberg,IDV
-
- To: AUST0134 Jam Software Sydney,IVR
- MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Performance Tools
-
- When I tried to use the MacApp performance tools, I also had the impression
- that they are pretty useless - they seem only to work with -debug versions, and
- I am interested in the performance of the final (-nodebug) version only.
-
- My solution was to override TApplication.PerformCommand with the following
- method:
-
- {$S ARes}
- PROCEDURE TMacWebApplication.PerformCommand(command: TCommand); override;
- {$IFC qPerform and not qDebug}
- var thePerfGlobals: TP2PerfGlobals; { ??? must not be in the final version }
- procedure OpenPerf; { ??? must not be in the final version }
- var aKeyMap: KeyMap;
- begin
- thePerfGlobals := nil;
- GetKeys(aKeyMap);
- if aKeyMap[$3b] then begin { control char pressed }
- if not InitPerf(thePerfGlobals, 2, 2, true, true, 'CODE', 0, '', false, 0,
- 0, 0)
- then thePerfGlobals := nil; { just to be sure }
- if (thePerfGlobals <> NIL) & PerfControl(thePerfGlobals, true) then { fine!
- };
- end;
- end;
- procedure ClosePerf; { ??? must not be in the final version }
- begin
- if thePerfGlobals <> NIL then begin
- FailOSErr(PerfDump(thePerfGlobals, 'Perform.out', false, 0));
- TermPerf(thePerfGlobals);
- thePerfGlobals := NIL;
- end;
- end;
- procedure HandleFailure(error: OSErr; message: Longint);
- begin
- gEventLevel := gEventLevel -1;
- ClosePerf;
- end;
- VAR fi: FailInfo;
- {$ENDC}
- BEGIN
- {$IFC qPerform and not qDebug}
- OpenPerf;
- CatchFailures(fi, HandleFailure);
- gEventLevel := gEventLevel +1; { prevent segment unloading }
- inherited PerformCommand(command);
- Success(fi);
- gEventLevel := gEventLevel -1;
- ClosePerf;
- {$ELSEC}
- inherited PerformCommand(command);
- {$ENDC}
- END;
-
- This allows you to get performance data about execution of of any command
- handled by a TCommand object simply by holding the control key when it is
- launched.
-
- To use this method, you have to add the “Perf” unit to the “uses” declaration
- of the unit containing the method, and to build the application with “-nodebug
- -perform”. The order of the options is significant, as MABuildTool turns off
- performance measurement when it sees the -nodebug option.
-
- You also may wish to fiddle with the arguments to InitPerf - see the
- “Performance Measurement Tools” chapter in the MPW Reference for details. To
- use the arguments as given above, I had to increase the MultiFinder partition
- of my application to 1.5MB (from 600KB).
-
- Hope this helps.
-
- -- Norbert
-
-